﻿
@{
    ViewData["Title"] = "Login";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>云ERP系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <script src="~/lib/vue.min.js"></script>

    <script src="~/lib/axios.js"></script>
</head>
<body class="login-bg">

    <div id="app" class="login layui-anim layui-anim-up">
        <div class="message">云ERP系统</div>
        <div id="darkbannerwrap"></div>

        <input name="username" id="user" placeholder="用户名" type="text" v-model="form.username" lay-verify="required" class="layui-input">
        <hr class="hr15">    
        <input name="password" id="pass" lay-verify="required" placeholder="密码" v-model="form.password" type="password" class="layui-input">
        <hr class="hr15">
        <input value="登录" style="width:100%;" v-on:click="login" type="button">@*lay-submit lay-filter="login"*@
        <hr class="hr20">

        <div v-html="form.username"></div>
        <div v-html="form.password"></div>

    </div>

    <script>

        new Vue({

            el: "#app",
            data: {
                message: '<h1>菜鸟教程</h1>',
                form: {
                    username: '',
                    password: '',
                },
                info: null

            },
            methods: {
               

                login: function () {
                    axios({
                        headers: {'Content-Type': 'application/json'},
                        method: 'POST',
                        url: '/Admin/User/doLogin/',
                      
                        data: {
                            username: this.form.username,
                            password: this.form.password
                        }
                       
                        
                    }).then(function (res) {
                        if (res.data.data=="error") {

                            alert("登录失败");

                        } else {
                            window.location.replace("/Home/Index");
                        //  this.$router.push("/Home/Index");
                           // alert(JSON.stringify(res));
                        }
                    }
                    );}
            }



        })


    </script>



    <div id="apps">
        <p>本系统基于Vue 和layUI 开发建议使用google 浏览器</p>
  

    </div>

  
</body>
</html>



